package com.example.demo.file;

import cn.hutool.core.img.gif.AnimatedGifEncoder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class gif {

    public static void main(String[] args) throws IOException {
        BufferedImage src = ImageIO.read(new File("F:\\123.png")); // 读入文件
        BufferedImage src1 = ImageIO.read(new File("F:\\12.jpg")); // 读入文件
        AnimatedGifEncoder e = new AnimatedGifEncoder();
        e.setRepeat(0);
        e.start("f:/laoma.gif");
        e.setDelay(3000); // 1 frame per sec
        e.addFrame(src);
        e.setDelay(1000);
        e.addFrame(src1);
        e.finish();
    }

}
